@extends('template.base')
@section('content')
 <script src="{{URL::to('js/jquery-1.10.2.js')}}"></script>
		<script>
		$(document).ready(function(){
		  $("#hide").click(function(){
		    $("#p").hide();
		  });
		  $("#show").click(function(){
		    $("#p").show();
		  });
		});


		$(document).ready(function(){
		  $("#hide2").click(function(){
		    $("#p2").hide();
		  });
		  $("#show2").click(function(){
		    $("#p2").show();
		  });
		});
		</script>
		<div class="container-green" >
		<h2 class="text-center">ORDER ONLINE</h2>
				<div class="btn-group btn-group-justified" style="margin-bottom:20px">
						  <div class="btn-group">
						    <button type="button" class="btn btn-default active"><strong>Data Pesanan(Order)</strong></button>
						  </div>
						  <div class="btn-group">
						    <button type="button" class="btn btn-default" disabled><strong>Fitur Tambahan</strong></button>
						  </div>
						  <div class="btn-group">
						    <button type="button" class="btn btn-default" disabled><strong>Data Pemesan(Client)</strong></button>
						  </div>
				</div>
		<div class="row">
			<div class="col-lg-3">
			<label>Order :</label>
			<hr id="hr1" />
			<strong>Cetak Packaging</strong><br><br>
			<p align="center"><img id="img" src="{{URL::to('images/icon_packaging.jpg')}}" /><br><br>
			<a data-toggle="modal" data-target="#gantiorder"><button class="btn btn-primary" style="width:125px">Ganti order</button></a></p>    
			</div>
			<div class="col-lg-9">
			<label>Data pesanan(Detail order):</label>
			<hr id="hr1" />

					<div align="left">
							{{Form::open(array(
								'url' => 'order/orderpackaging',
								'method' => 'POST',
								'files' => true
							))}}

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Jenis kemasan <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<table>
      						<td>
				            <select class="form-control"  name="jenis_packaging" style="width:250px;height:30px" required>
				            	<option value="">Silahkan pilih</option>
				            	<?php 
				            		if(Input::Old('jenis_packaging')<>""){
					            	$id = Input::Old('jenis_packaging');
					            	}else{
					            	$id = Session::get('jenis_packaging');
					           		}
					            	
									foreach($jenis as $type){
										if($type->packaging_type == $id){
											echo '<option value="'.$type->packaging_type.'" selected>'.$type->packaging_type.'</option>';
										}else{
											echo '<option value="'.$type->packaging_type.'">'.$type->packaging_type.'</option>';
										}
									}
					            	?>
				            </select>
					        </td>
					        <td>
					        	  {{$errors->first('jenis_packaging')}}
					        </td>
					    	</table><br>
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Ukuran <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-7">
      						<?php
      							if(Input::Old('pilihan_ukuran')<>""){
					            	$pilihan_ukuran = Input::Old('pilihan_ukuran');
					            	}else{
					            	$pilihan_ukuran = Session::get('pilihan_ukuran');
					            }

					            if(Input::Old('length')<>""){
					            	$length = Input::Old('length');
					            	}else{
					            	$length = Session::get('length');
					            }

					            if(Input::Old('width')<>""){
					            	$width = Input::Old('width');
					            	}else{
					            	$width = Session::get('width');
					            }

					            if(Input::Old('height')<>""){
					            	$height = Input::Old('height');
					            	}else{
					            	$height = Session::get('height');
					            }

					            if(Input::Old('ukuran_standar')<>""){
					            	$ukuran_standar = Input::Old('ukuran_standar');
					            	}else{
					            	$ukuran_standar = Session::get('ukuran_standar');
					            }
      						?>
				            <input type="radio" name="pilihan_ukuran" value="0" id="hide" <?php if($pilihan_ukuran=='0'){echo "checked";} ?>  required /> Standar (Default)   
				            <br>
				            <table><td>
				             <select class="form-control"  name="ukuran_standar" style="width:250px;height:30px" >
				            	<option value="">Silahkan pilih</option>
				            	<?php 
									foreach($ukuran as $size){
										if($size->packaging_id == $ukuran_standar){
											echo '<option value="'.$size->packaging_id.'" selected>'.$size->packaging_length.' x '.$size->packaging_width.' x '.$size->packaging_height.'</option>';
										}else{
											echo '<option value="'.$size->packaging_id.'">'.$size->packaging_length.' x '.$size->packaging_width.' x '.$size->packaging_height.'</option>';
										}
									}
					            	?>
				            </select>
				            </td><td>
				            <strong> P x L x T </strong>
				        	</td></table>
				            {{$errors->first('ukuran_standar')}}<br>
				            		<input type="radio" name="pilihan_ukuran" value="1" id="show" <?php if($pilihan_ukuran=='1'){echo "checked";} ?> required />  Custom  
				            		<br>
				            		<b id="p"  <?php if($pilihan_ukuran=='1'){echo "style='display:block'";}else{echo "style='display:none'";} ?>>
				            		<input type="text"  name="length" style="width:73px;height:30px" value="{{$length}}" /><strong> x </strong>
				            		<input type="text"  name="width" style="width:73px;height:30px" value="{{$width}}" /><strong> x </strong>
				            		<input type="text"  name="height" style="width:73px;height:30px" value="{{$height}}" /><strong> P x L x T </strong>
				            		<br>
				            		</b>
				            	
					          {{Session::get('errorsize')}}
				            <br>
				            </div>
				      		</div>

				

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Jenis kertas <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<table>
      						<td>
				            <select class="form-control"  name="jenis_kertas" style="width:250px;height:30px" required>
				            	<option value="">Silahkan pilih</option>
				            	<?php 
					            	if(Input::Old('jenis_kertas')<>""){
					            	$jeniskertas = Input::Old('jenis_kertas');
					            	}else{
					            	$jeniskertas = Session::get('jenis_kertas');
					            	}
									foreach($kertas as $paper){
										if($paper->papertype_name == $jeniskertas){
											echo '<option value="'.$paper->papertype_name.'" selected>'.$paper->papertype_name.'</option>';
										}else{
											echo '<option value="'.$paper->papertype_name.'">'.$paper->papertype_name.'</option>';
										}
									}
					            	?>
				            </select>
				        	</td>
				        	<td>
				        		{{$errors->first('jenis_kertas')}}
				        	</td>
				        </table>
				        	<br>
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Design (Referensi / Sendiri)</label><br>
				      		(Format *ai, *psd, *jpg, *png, *cdr, max 5MB)
				      		</div>
      						<div class="col-lg-7">
				            <input type="file" class="form-control" id="i_file" name="design_packaging" style="width:250px;height:30px" />
				            <br>
				            </div>
				      		</div>

				      		<div class="row">
      						<div class="col-lg-4 col-lg-offset-1">
				      		<label>Jumlah order <font color="red">*</font></label>
				      		</div>
      						<div class="col-lg-6">
      						<?php 
      								if(Input::Old('pilihan_jumlah')<>""){
					            	$pilihan_jumlah = Input::Old('pilihan_jumlah');
					            	}else{
					            	$pilihan_jumlah = Session::get('pilihan_jumlah');
					            	}

					            	if(Input::Old('jumlah_custom')<>""){
					            	$jumlah_custom = Input::Old('jumlah_custom');
					            	}else{
					            	$jumlah_custom = Session::get('jumlah_custom');
					            	}

					            	if(Input::Old('jumlah_standar')<>""){
					            	$jumlah_standar = Input::Old('jumlah_standar');
					            	}else{
					            	$jumlah_standar = Session::get('jumlah_standar');
					            	}
					         ?>
				            <input type="radio"  name="pilihan_jumlah" value="0" id="hide2" <?php if($pilihan_jumlah==''){echo "checked";} ?> required /> Standar (Default)   {{$errors->first('pilihan_jumlah')}}
				            <select  class="form-control" style="width:250px;height:30px" name="jumlah_standar" >
				            	 
				                <option value="1000">1000</option>
				                <option value="2000">2000</option>
				                <option value="3000">3000</option>
				                <option value="4000">4000</option>
				            </select>
				            <br>
				            <table>
				           	<td>
				            	<input type="radio" name="pilihan_jumlah" value="1" id="show2" <?php if($pilihan_jumlah=='1'){echo "checked";} ?> required />  Custom Jumlah 
				            </td>
				            <td>
				            	<b id="p2"  <?php if($pilihan_jumlah=='1'){echo "style='display:block'";}else{echo "style='display:none'";} ?>>
				            		<input type="number" min="1000"  name="jumlah_custom" style="width:100px;height:30px" value="{{$jumlah_custom}}" /><strong> Pcs </strong>
				            	</b>
				            </td>
				        	</table>
				            
				            {{$errors->first('jumlah_custom')}}
				            <br><br>
				            </div>
				      		</div>
				      		

				    </div>
			<hr id="hr1" />
			<font color="red">* Data tidak boleh kosong</font><br><br>

			<p style="margin-bottom:55px"><button type="submit" id="i_submit" class="btn btn-success pull-right" style="width:125px">Lanjutkan</button>{{form::close()}}<a href="{{URL::to('/')}}"><button class="btn btn-danger pull-right" style="width:125px; margin-right:5px">Kembali</button></a></p>
			
			

			</div>
	</div>
	</div>

	<div class="modal fade" id="gantiorder" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog" style="width:80%">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:10px">Ganti order</label></h4>
                    </div>
                    <div class="container" style="width:100%">
                    	<br>
					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Brosur</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/icon_marketting-kit.jpg')}}" /><br><br>
					           <a href="{{URL::to('order/orderbrosur')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>  
					          </div> 
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">ID Card</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/icon_kartu.jpg')}}" /></br></br>
					          <a href="{{URL::to('order/orderidcard')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>     
					          </div>                
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Packaging</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/icon_packaging.jpg')}}" /></br></br>
					           <a href="{{URL::to('order/orderpackaging')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>
					          </div>                
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Kaos</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/tshirt_product.png')}}" /></br></br>
					          <a href="{{URL::to('order/ordertshirt')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>
					          </div>                
					        </div>
					      </div>

					      <div class="col-sm-2">
					        <div class="panel panel-success">
					          <div class="panel-heading">
					            <h2 class="panel-title" align="center">Nota</h2>
					          </div>
					          <div class="panel-body">
					          <p align="center"><img id="img" src="{{URL::to('images/nota_product.png')}}" /></br></br>
					          <a href="{{URL::to('order/ordernota')}}"><button class="btn btn-primary" style="width:100px">Pesan</button></a></p>
					          </div>                
					        </div>
					      </div>
					</div> 
				</div> 
                 </div>
</div>
	<script type="text/javascript">

		$('#i_submit').click( function() {
		    //check whether browser fully supports all File API
		    if (window.File && window.FileReader && window.FileList && window.Blob)
		    {
		        //get the file size and file type from file input field
		        var fsize = $('#i_file')[0].files[0].size;
		       
		        if(fsize>5097152) //do something if file size more than 1 mb (1048576)
		        {
		            setTimeout(function(){
				       alert("File desain terlalu besar\nSilahkan ganti!");
				    }, 1000);
		           	return false; 
		        }
		    }else{
		        alert("Please upgrade your browser, because your current browser lacks some new features we need!");
		    }
		});


	</script>
@stop
@stop